<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/sslphrc.asp" -->
<%
' *** Edit Operations: declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Request.QueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables

If (CStr(Request("MM_insert")) = "form1") Then

  MM_editConnection = MM_sslphrc_STRING
  MM_editTable = "dbo.rrcPayments"
  MM_editRedirectUrl = "register1.asp"
  MM_fieldsStr  = "realname|value|address1|value|city1|value|state1|value|zip1|value|phone1|value|email|value|retreat1|value|CardName1|value|CardNumber1|value|Expire1|value|comments|value"
  MM_columnsStr = "paymentName|',none,''|paymentAddress1|',none,''|paymentCity|',none,''|paymentState|',none,''|paymentZip|',none,''|paymentPhone|',none,''|paymentEmail|',none,''|paymentRetreat|',none,''|paymentCCType|',none,''|paymentCCNumber|',none,''|paymentCCDate|',none,''|paymentComments|',none,''"

  ' create the MM_fields and MM_columns arrays
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")
  
  ' set the form values
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
  Next

  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
  End If

End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it

Dim MM_tableValues
Dim MM_dbValues

If (CStr(Request("MM_insert")) <> "") Then

  ' create the sql insert statement
  MM_tableValues = ""
  MM_dbValues = ""
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_formVal = MM_fields(MM_i+1)
    MM_typeArray = Split(MM_columns(MM_i+1),",")
    MM_delim = MM_typeArray(0)
    If (MM_delim = "none") Then MM_delim = ""
    MM_altVal = MM_typeArray(1)
    If (MM_altVal = "none") Then MM_altVal = ""
    MM_emptyVal = MM_typeArray(2)
    If (MM_emptyVal = "none") Then MM_emptyVal = ""
    If (MM_formVal = "") Then
      MM_formVal = MM_emptyVal
    Else
      If (MM_altVal <> "") Then
        MM_formVal = MM_altVal
      ElseIf (MM_delim = "'") Then  ' escape quotes
        MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
      Else
        MM_formVal = MM_delim + MM_formVal + MM_delim
      End If
    End If
    If (MM_i <> LBound(MM_fields)) Then
      MM_tableValues = MM_tableValues & ","
      MM_dbValues = MM_dbValues & ","
    End If
    MM_tableValues = MM_tableValues & MM_columns(MM_i)
    MM_dbValues = MM_dbValues & MM_formVal
  Next
  MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

  If (Not MM_abortEdit) Then
    ' execute the insert
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

	Set MM_editCmd = Server.CreateObject("ADODB.Recordset")
	MM_editCmd.ActiveConnection = MM_sslphrc_STRING
	MM_editCmd.Source = "SELECT paymentID  FROM dbo.rrcPayments ORDER BY paymentID DESC;"
	MM_editCmd.CursorType = 0
	MM_editCmd.CursorLocation = 2
	MM_editCmd.LockType = 1
	MM_editCmd.Open()
	If NOT MM_editCmd.EOF AND NOT MM_editCmd.BOF Then
		pID = MM_editCmd.Fields.Item("paymentID").Value
		MM_editRedirectUrl = MM_editRedirectUrl & "?ID=" & pID
	End If
	MM_editCmd.Close()
	Set MM_editCmd = Nothing

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_sslphrc_STRING
Recordset1.Source = "SELECT RetreatName, RetreatMonth, StartDate, RetreatYear  FROM trinity.rrcDates  WHERE RetreatID > 1 AND RetreatID < 90  ORDER BY RetreatName"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<html><!-- #BeginTemplate "/Templates/rrc_detail.dwt" --><!-- DW6 -->
<head>
<meta name="description" content="Once the exclusive domain of monastics and clerics, 
retreats have become commonplace in the spiritual journey of the laity. 
In a world where it has become difficult to find the holy, retreats provide the space and 
time to rediscover the mystery of being loved by God. There is no right or wrong way to 
make a retreat; there is simply the individual and God, and a mysterious deepening of one's 
love for God.">
<meta name="keywords" content="retreats, spiritual journey, laity, love for God, renewal, 
Redemptorists, Milwaukee, Wisconsin, Chicago, Illinois, Madison, spiritual renewal, 
holiness, Jesus Christ, Christianity, St. Alphonsus, Liguori, poor, marginalized, missions, 
evangelize, evangelization, Catholic, Catholicism, saints, Holy Spirit, God, mystery, Celtic
Spirituality, Contemplative, Franciscan, Sacraments, personal growth, spiritual enrichment, vocations
priests, CSSR, cssr">
<!-- #BeginEditable "doctitle" -->
<title>Retreat Registration Form</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function YY_checkform() { //v4.66
//copyright (c)1998,2002 Yaromat.com
  var args = YY_checkform.arguments; var myDot=true; var myV=''; var myErr='';var addErr=false;var myReq;
  for (var i=1; i<args.length;i=i+4){
    if (args[i+1].charAt(0)=='#'){myReq=true; args[i+1]=args[i+1].substring(1);}else{myReq=false}
    var myObj = MM_findObj(args[i].replace(/\[\d+\]/ig,""));
    myV=myObj.value;
    if (myObj.type=='text'||myObj.type=='password'||myObj.type=='hidden'){
      if (myReq&&myObj.value.length==0){addErr=true}
      if ((myV.length>0)&&(args[i+2]==1)){ //fromto
        var myMa=args[i+1].split('_');if(isNaN(myV)||myV<myMa[0]/1||myV > myMa[1]/1){addErr=true}
      } else if ((myV.length>0)&&(args[i+2]==2)){
          var rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-z]{2,4}$");if(!rx.test(myV))addErr=true;
      } else if ((myV.length>0)&&(args[i+2]==3)){ // date
        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);
        if(myAt){
          var myD=(myAt[myMa[1]])?myAt[myMa[1]]:1; var myM=myAt[myMa[2]]-1; var myY=myAt[myMa[3]];
          var myDate=new Date(myY,myM,myD);
          if(myDate.getFullYear()!=myY||myDate.getDate()!=myD||myDate.getMonth()!=myM){addErr=true};
        }else{addErr=true}
      } else if ((myV.length>0)&&(args[i+2]==4)){ // time
        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);if(!myAt){addErr=true}
      } else if (myV.length>0&&args[i+2]==5){ // check this 2
            var myObj1 = MM_findObj(args[i+1].replace(/\[\d+\]/ig,""));
            if(myObj1.length)myObj1=myObj1[args[i+1].replace(/(.*\[)|(\].*)/ig,"")];
            if(!myObj1.checked){addErr=true}
      } else if (myV.length>0&&args[i+2]==6){ // the same
            var myObj1 = MM_findObj(args[i+1]);
            if(myV!=myObj1.value){addErr=true}
      }
    } else
    if (!myObj.type&&myObj.length>0&&myObj[0].type=='radio'){
          var myTest = args[i].match(/(.*)\[(\d+)\].*/i);
          var myObj1=(myObj.length>1)?myObj[myTest[2]]:myObj;
      if (args[i+2]==1&&myObj1&&myObj1.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
      if (args[i+2]==2){
        var myDot=false;
        for(var j=0;j<myObj.length;j++){myDot=myDot||myObj[j].checked}
        if(!myDot){myErr+='* ' +args[i+3]+'\n'}
      }
    } else if (myObj.type=='checkbox'){
      if(args[i+2]==1&&myObj.checked==false){addErr=true}
      if(args[i+2]==2&&myObj.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
    } else if (myObj.type=='select-one'||myObj.type=='select-multiple'){
      if(args[i+2]==1&&myObj.selectedIndex/1==0){addErr=true}
    }else if (myObj.type=='textarea'){
      if(myV.length<args[i+1]){addErr=true}
    }
    if (addErr){myErr+='* '+args[i+3]+'\n'; addErr=false}
  }
  if (myErr!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+myErr)}
  document.MM_returnValue = (myErr=='');
}
//-->
</script>
<!-- #EndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
//-->
</script>
</head>

<body bgcolor="#F9F7ED" text="#000000" onLoad="MM_preloadImages('../images/logohome2.gif')">
<table width="90%" border="0" cellspacing="0" cellpadding="0" height="800" align="center">
  <tr> 
    <td rowspan="2" valign="top" height="250" width="20%"> <!-- #BeginLibraryItem "/library/leftmenu.lbi" --><table width="55%" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr> 
          
    <td><a href="../Default.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image20','','../images/logohome2.gif',1)"><img src="../images/logohome.gif" alt="Redemptorist Retreat Center" name="Image20" width="144" height="136" border="0"></a></td>
        </tr>
        <tr> 
          
    <td><a href="../our_mission.htm"><img src="../images/missionside.gif" alt="The Mission of the Redemptorist Retreat Center" width="144" height="29" border="0"></a></td>
        </tr>
        <tr> 
          
    <td><a href="../news.asp"><img src="../images/newsside.gif" alt="Redemptorist Retreat Center News" border="0"></a></td>
        </tr>
        <tr> 
          
    <td><a href="../spiritual_growth.asp"><img src="../images/spiritualside.gif" alt="Spiritual Growth Programs at the Redemptorist Retreat Center" width="144" height="28" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="../preached_retreats.asp"><img src="../images/preachedside.gif" border="0" width="144" height="27"></a></td>
        </tr>
        <tr> 
          
    <td><a href="../personal_retreats.asp"><img src="../images/personalside.gif" alt="Personal Retreats at the Redemptorist Retreat Center" width="144" height="27" border="0"></a></td>
        </tr>
        <tr> 
          
    <td><a href="../couples.asp"><img src="../images/marriedside.gif" alt="Married Couple Retreats at the Redemptorist Retreat Center" width="144" height="27" border="0"></a></td>
        </tr>
        <tr> 
          
    <td><a href="../redemptorists.htm"><img src="../images/redemptside.gif" alt="About the Redemptorists" width="144" height="27" border="0"></a></td>
        </tr>
        <tr> 
          
    <td><a href="../facility_tour.htm"><img src="../images/tourside.gif" alt="Tour the Facility at the Redemptorist Retreat Center" width="144" height="28" border="0"></a></td>
        </tr>
        <tr> 
          
    <td><a href="../staff.asp"><img src="../images/staffside.gif" alt="Meet the Staff of the Redemptorist Retreat Center" width="144" height="28" border="0"></a></td>
        </tr>
        <tr> 
          
    <td><a href="../help_needed.htm"><img src="../images/helpside.gif" alt="Volunteers Needed at the Redemptorist Retreat Center" width="144" height="27" border="0"></a></td>
        </tr>

      </table>
<!-- #EndLibraryItem --></td>
    <td width="85%"><!-- #BeginEditable "Banner" -->
      <h1><font color="#FFCC00" face="Times New Roman, Times, serif">Retreat Registration Form</font></h1>
      <!-- #EndEditable --></td>
  </tr>
  <tr> 
    <td width="85%" height="528" valign="top"><!-- #BeginEditable "Body" -->
      <form action="<%=MM_editAction%>" method="POST" name="form1" onSubmit="YY_checkform('form1','realname','#q','0','Please enter your name.','address1','#q','0','Please enter your street address.','city1','#q','0','Please enter the city you live in.','state1','#q','0','Please enter the state you live in.','zip1','#q','0','Please enter your zip code.','phone1','#q','0','Please enter your telephone number with area code.','email','#S','2','Please enter your email address','retreat1','#q','1','Please select the retreat you are registering for.','CardName1','#q','1','Field \'CardName1\' is not valid.');return document.MM_returnValue">
        <table width="100%" border="0" cellspacing="3" cellpadding="3">
          <tr> 
            <td colspan="2"><h3><font face="arial, Arial, Helvetica"><font color="#FFCC00" face="Times New Roman, Times, serif"><big><strong>Each 
                retreat or program requires a separate registration form.</strong></big></font></font></h3></td>
          </tr>
          <tr> 
            <td><font face="Verdana, Arial, Helvetica, sans-serif">Name</font></td>
            <td><input name="realname" type="text" id="realname" size="50"></td>
          </tr>
          <tr> 
            <td><font face="Verdana, Arial, Helvetica, sans-serif">Address</font></td>
            <td><input name="address1" type="text" id="address1" size="50"></td>
          </tr>
          <tr> 
            <td><font face="Verdana, Arial, Helvetica, sans-serif">City</font></td>
            <td><input name="city1" type="text" id="city1" size="50"></td>
          </tr>
          <tr> 
            <td><font face="Verdana, Arial, Helvetica, sans-serif">State</font></td>
            <td><input name="state1" type="text" id="state1" size="10" maxlength="2"></td>
          </tr>
          <tr> 
            <td><font face="Verdana, Arial, Helvetica, sans-serif">Zip</font></td>
            <td><input name="zip1" type="text" id="zip1" size="10" maxlength="10"></td>
          </tr>
          <tr> 
            <td><font face="Verdana, Arial, Helvetica, sans-serif">Telephone</font></td>
            <td><input name="phone1" type="text" id="phone1" size="30"></td>
          </tr>
          <tr> 
            <td><font face="Verdana, Arial, Helvetica, sans-serif">Email</font></td>
            <td><input name="email" type="text" id="email" size="50"></td>
          </tr>
          <tr> 
            <td><font face="Verdana, Arial, Helvetica, sans-serif">Retreat/Program 
              Name</font></td>
            <td> <select name="retreat1" id="retreat1">
                <option value="">Select Retreat or Program</option>
                <%
While (NOT Recordset1.EOF)
%>
                <option value="<%=(Recordset1.Fields.Item("RetreatName").Value)%>&nbsp;<%=(Recordset1.Fields.Item("RetreatMonth").Value)%>&nbsp;<%=(Recordset1.Fields.Item("StartDate").Value)%>,&nbsp;<%=(Recordset1.Fields.Item("RetreatYear").Value)%>"><%=(Recordset1.Fields.Item("RetreatName").Value)%>&nbsp;<%=(Recordset1.Fields.Item("RetreatMonth").Value)%>&nbsp;<%=(Recordset1.Fields.Item("StartDate").Value)%>,&nbsp;<%=(Recordset1.Fields.Item("RetreatYear").Value)%></option>
                <%
  Recordset1.MoveNext()
Wend
If (Recordset1.CursorType > 0) Then
  Recordset1.MoveFirst
Else
  Recordset1.Requery
End If
%>
              </select></td>
          </tr>
          <tr> 
            <td colspan="2"><font face="Verdana, Arial, Helvetica, sans-serif"><strong>Some 
              of our retreats require a deposit, please provide payment information 
              too</strong></font></td>
          </tr>
          <tr> 
            <td align="left"><font face="Verdana, Arial, Helvetica, sans-serif">Card 
              Type</font></td>
            <td>
<select name="CardName1" id="CardName1">
<option selected>Select Card Type
<option value="Master Card">Master Card
<option value="Visa">Visa
<option value="Check">Check
              
</select></td>
          </tr>
          <tr> 
            <td align="left"><font face="Verdana, Arial, Helvetica, sans-serif">Card 
              Number</font></td>
            <td>
<input name="CardNumber1" type="text" id="CardNumber1" size="30"></td>
          </tr>
          <tr> 
            <td align="left"><font face="Verdana, Arial, Helvetica, sans-serif">Expiration 
              Date</font></td>
            <td>
<input name="Expire1" type="text" id="Expire1" size="30"></td>
          </tr>
          <tr>
            <td colspan="2" align="right"><div align="left"><font face="Verdana, Arial, Helvetica, sans-serif"><strong>Please add your comments below. If
                you have any special dietary needs, or want to make us aware of
              any other special needs you have, please let us know!</strong></font></div></td>
          </tr>
          <tr>
            <td colspan="2" align="right"><textarea name="comments" cols="80" rows="3" id="comments"></textarea></td>
          </tr>
          <tr> 
            <td align="right"> <input type="submit" name="Submit" value="Register"> 
            </td>
            <td>&nbsp;</td>
          </tr>
        </table>
      
        <input type="hidden" name="MM_insert" value="form1">
      </form>
      <!-- #EndEditable --></td>
  </tr>
  <tr> 
    <td width="15%">&nbsp;</td>
    <td width="85%"> 
      <table width="50%" border="0" cellspacing="0" cellpadding="0" align="center" valign="top">
        <tr> 
          <td width="40%"align="right" valign="middle"><a href="../calendar.htm"><img src="../images/calendar.gif" width="101" height="29" border="0"></a></td>
          <td width="20%" align="center" valign="middle"><a href="../feedback.htm"><img src="../images/feedback.gif" width="102" height="29" border="0"></a></td>
          <td width="40%" align="left" valign="middle"><a href="../location.htm"><img src="../images/map.gif" width="103" height="29" border="0"></a></td>
        </tr>
 
      </table><table width="50%" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr align="center"> 
          <td align="right" valign="middle" width="50%"> 
            <div align="right"><a href="https://secure6.appliedi.net/rretreat/ssl/register.asp"><img src="../images/registration.gif" width="103" height="30" border="0"></a></div>
          </td>
          <td align="left" valign="middle" width="50%"> 
            <div align="left"><a href="../search.htm"><img src="../images/search.gif" width="104" height="31" align="middle" border="0"></a></div>
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
</body>
<!-- #EndTemplate --></html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
